package com.s63.appinfo.util;

import org.springframework.web.multipart.commons.CommonsMultipartResolver;

import javax.servlet.http.HttpServletRequest;

public class MyCommonsMultipartResolver extends CommonsMultipartResolver {
    @Override
    public boolean isMultipart(HttpServletRequest request) {
        if (!"post".equals(request.getMethod().toLowerCase()) &&
             !"put".equals(request.getMethod().toLowerCase())
            ) {
            return false;
        } else {
            String contentType = request.getContentType();
            if (contentType == null) {
                return false;
            } else {
                return contentType.toLowerCase().startsWith("multipart/");
            }
        }
    }
}
